package com.blog.study.study6;

import java.time.Clock;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * Java8新特性之Clock类.
 *
 * @author 张俊强~.
 * @date 2017/11/30-14:05.
 */
public class TestDateTime {

    public static void main(String[] args) {
        Clock clock=Clock.systemDefaultZone();
        long millis=clock.millis();
        System.out.println(millis);

        Instant instant=Instant.now();
        System.out.println(instant.toEpochMilli());

        LocalDateTime localDateTime=LocalDateTime.now();
        System.out.println(localDateTime.toLocalTime());

        DateTimeFormatter formatter=DateTimeFormatter.ofPattern("YYYY-MM-dd HH:mm:SS");
        System.out.println(formatter.format(localDateTime));
    }

}
